<template>
  <svg aria-hidden="true" class="icon" :style="{ color }">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<script>
export default {
  name: 'SvgIcon',
  props: {
    prefix: {
      type: String,
      default: 'icon',
    },
    name: {
      type: String,
      required: true,
    },
    color: {
      type: String,
      default: '#333',
    },
  },
  computed: {
    symbolId() {
      return `#${this.prefix}-${this.name}`;
    },
  },
};
</script>

<style lang="less" scoped>
.icon {
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
